import request from '@/utils/request';
import qs from 'qs';

// 用户充值账单列表
export function getBillListApi(query) {
  return request({
    baseURL: process.env.LIFE_ADMIN_API,
    url: `/shop/bill/get_list`,
    method: 'get',
    params: query
  });
}

// 手动充值账单列表
export function getManualListApi(query) {
  return request({
    baseURL: process.env.LIFE_ADMIN_API,
    url: `/shop/bill/get_manual_list`,
    method: 'get',
    params: query
  });
}

// 获取充值总金额
export function getBillTotal(query) {
  return request({
    baseURL: process.env.LIFE_ADMIN_API,
    url: '/shop/bill/get_sum_total',
    method: 'get',
    params: query
  });
}

// 获取手动充值总金额
export function getManualBillTotal(query) {
  return request({
    baseURL: process.env.LIFE_ADMIN_API,
    url: '/shop/bill/get_manual_sum_total',
    method: 'get',
    params: query
  });
}

// 账单导出
export function exportApi(query) {
  return request({
    baseURL: process.env.LIFE_ADMIN_API,
    url: `/shop/bill/export`,
    method: 'get',
    params: query
  });
}

// 充值账单退款请求
export function refundApi(query) {
  return request({
    baseURL: process.env.LIFE_ADMIN_API,
    url: `/shop/bill/enforce_refund`,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    method: 'post',
    data: qs.stringify(query)
  });
}

// 手动修改账单状态
export function updateStatusApi(query) {
  return request({
    baseURL: process.env.LIFE_ADMIN_API,
    url: `/shop/bill/update_status`,
    method: 'post',
    data: query
  });
}

// 手动修改用户充值账单状态
export function updateRechargeStatusApi(query) {
  return request({
    baseURL: process.env.LIFE_ADMIN_API,
    url: `/shop/bill/update_recharge_status`,
    method: 'post',
    data: query
  });
}
